package BaseRows
{
	import data.MyBorderContainer;
	
	import flash.events.ContextMenuEvent;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuItem;
	
	import mx.collections.ArrayList;
	
	/*
		failure mode row
	*/
	public class EQrow
	{
		public var d1:String,d2:String,d3:String,d4:String,d5:String,d6:uint,d7:uint,d8:String;
		
		
		 //properties win 에서 적용되어야 할 속성
		
			//general
			public var subSystem:String
			public var eqName:String;
			public var tagId:String;
			
			public var figUid:int;
		
		
			[Bindable]
			 public var failureMode:String="CRT";
			 
			 
			 [Bindable]
			 public var impactOfFailure:Number=100;
			 [Bindable]
			 public var impactOfRepair:Number=100;
			 [Bindable]
			 public var delivery:String="0";
		
			//failure
			private var _distribution:String="Exponential";
			
				 
				[Bindable]
				public var failureTabIndex:uint=0;
				
				//exponential
				 [Bindable]
				 public var MTTF:String="0";
				
				//normal
				[Bindable]
				public var expectedValue:String;
				[Bindable]
				public var standardDeviation:String;
				
				//rectangular&triangular
				[Bindable]
				public var minTTF:String;
				[Bindable]
				public var maxTTF:String;
				[Bindable]
				public var mostLikelyTTF:String;
				
				//weibull(no delay&time delay)
				[Bindable]
				public var charactristric:String;
				[Bindable]
				public var shapeFactor:String;
				[Bindable]
				public var timeDelay:String;
			
			//repair
			[Bindable]
			public var repairDistribution:String="Exponential";
			[Bindable]
			public var MTTR:String;
			[Bindable]
			public var reliabilityReductionFactor:String="100";
			
			private var _modRelia:String;
			
			[Bindable]
			public var option_cb_selected:Boolean
			
			[Bindable]
			public var infinity_rb_seleced:Boolean
			[Bindable]
			public var upTo_rb_seleced:Boolean
			
			private var _repeat:String;
			
			[Bindable]
			public var upTo:uint;
		
			//releation
			[Bindable]
			public var relationDatas:ArrayList=new ArrayList();
		
		
		public function EQrow(_mbc:MyBorderContainer=null)
		{
			subSystem=_mbc.getBranch().title;	//subsystem
			eqName=_mbc.title;	//eq name
			tagId=_mbc.tagId;	//tag id
		}
		
			[Bindable]
			public function get distribution():String
			{
				return _distribution;
			}

			public function set distribution(value:String):void
			{
				_distribution = value;
				
				failureTabIndex = getExchangeFailureDistribution(value);
			}

			[Bindable]
			public function get repeat():String
			{
				return _repeat;
			}

			public function set repeat(value:String):void
			{
				_repeat = value;
				if(value=="Y"){
					infinity_rb_seleced=true;
					upTo_rb_seleced=false;
				}else{
					infinity_rb_seleced=false;
					upTo_rb_seleced=true;
				}
			}

			[Bindable]
			public function get modRelia():String
			{
				return _modRelia;
			}

			public function set modRelia(value:String):void
			{
				_modRelia = value;
				if(value=="Y"){
					option_cb_selected=true;
				}else{
					option_cb_selected=false;
					
				}
			}
			
			
			/*
				failureTabNavigator의 인덱스를 구하기위한 메서드.
			*/
			private function getExchangeFailureDistribution(_str:String):uint{
				switch(_str){
					case "Exponential":
						return 0;
						break;
					case "Normal":
						return 1;
						break;
					case "Rectangular":
						return 2;
						break;
					case "Triangular":
						return 3;
						break;
					case "Weibull(no delay)":
						return 4;
						break;
					case "Weibull(time delay)":
						return 5;
						break;
				}
				return 0;
			}

	}
}